Core Java - Interview Questions and Answers for 'Data types' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Core Java - Interview Questions and Answers for 'Data types' - 38 question(s) found - Order By Newest

next 30
  Q1. What is casting?Core Java
Ans. There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   casting  type casting   basic interview question     Asked in 8 Companies      basic        frequent


 Q2. What are the Wrapper classes available for primitive types ?Core Java
Ans. boolean - java.lang.Boolean
byte - java.lang.Byte
char - java.lang.Character
double - java.lang.Double
float - java.lang.Float
int - java.lang.Integer
long - java.lang.Long
short - java.lang.Short
void - java.lang.Void

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java5   data types   wrapper classes   adapter design pattern        rare


 Q3. What are wrapper classes ?Core Java
Ans. They are wrappers to primitive data types. They allow us to access primitives as objects.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   wrapper classes     Asked in 3 Companies      basic        frequent


 Q4. Why Java is not considered pure OOP's language ?Core Java
Ans. There are 2 reasons for it.

1. Usage of Primitive types - Though Java provides classes for the primitive data types but as the usage of primitives is permissible, its considered unpure OOP's language.

2. Usage of Static members - Static members belong to the class and not objects and hence not considered fit for pure OOP's programming.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops  object oriented programming  object oriented language  primitive data types     Asked in 2 Companies


 Q5. What is Generalization and Specialization in terms of casting ?Core Java
Ans. Generalization or UpCasting is a phenomenon where a sub class is prompted to a super class, and hence becomes more general. Generalization needs widening or up-casting. Specialization or DownCasting is a phenomenon where a super class is narrowed down to a sub class. Specialization needs narrowing or down-casting.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   casting  type casting   up casting  type casting   downcasting  type casting   generalization   specialization     Asked in 2 Companies


 Q6. What are the default or implicitly assigned values for data types in java ?
Ans. boolean ---> false
byte ----> 0
short ----> 0
int -----> 0
long ------> 0l
char -----> /u0000
float ------> 0.0f
double ----> 0.0d
any object reference ----> null

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   default values

Try 1 Question(s) Test


 Q7. What is the difference between float and double?
Ans. Float can represent up to 7 digits accurately after decimal point, where as double can represent up to 15 digits accurately after decimal point.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   float   double   difference between   basic interview question


 Q8. How do you prefer to store money values in your application ?Core Java
Ans. At Application level we use either Double or BigDecimal , preferably BigDecimal. At Database level we use Number with decimal precision 3.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     data types


 Q9. Difference between long.Class and Long.TYPE ?
Ans. They both represent the long primitive type. They are exactly the same.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   long.Class   long.TYPE   advanced      expert        rare


 Q10. What data type Variable can be used in a switch statement ?Core Java
Ans. Variables used in a switch statement can only be a byte, short, int, or char ( and String with Java 7 and above )

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   switch   variable   data type      basic        rare


 Q11. Variable of the boolean type is automatically initialized as?Core Java
Ans. The default value of the boolean type is false.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data type   boolean   initialization   default object construction   default constructor   default value


 Q12. Name few classes that extends Number Class ?
Ans. http://www.buggybread.com/2015/02/java-util-classes-that-inherit-number.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   number class


 Q13. Name few Boolean classes and interfaces ?
Ans. http://www.buggybread.com/2015/01/java-data-types-double-classes-and_31.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   boolean


 Q14. Name few Double data types related classes and interfaces ?
Ans. http://www.buggybread.com/2015/01/java-data-types-double-classes-and.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   double


 Q15. Name few float data type related classes and interfaces ?
Ans. http://www.buggybread.com/2015/01/java-data-types-float-classes-and.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   float


 Q16. Name few Integer related classes and interfaces ?
Ans. http://www.buggybread.com/2015/01/java-data-types-integer-classes-and.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   integer


 Q17. Name few long data type related classes and interfaces ?
Ans. http://www.buggybread.com/2015/01/java-data-types-long-classes-and.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   long


 Q18. What is the difference between Data Type and Data Structure ?Core Java
Ans. Data type: a set of values together with operations on that type
Data structure: a physical implementation of a data type

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   data structure   data type


 Q19. Is it correct to say that Interfaces are abstract data types ?
Ans. No.

Data Type holds data whereas Interface doesn't hold anything. Interface is a contract about how to communicate with the underlying Class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   interface   data type


 Q20. Do you see Class as a Data Type or Data Structure ?
Ans. Class can be better seen as Data Type. This could be implemented as a Data Structure too in some cases.

One thing worth understanding here is that Data type and Data structure are conceptual things. Class could be implementation of either of these.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   class   data type   data structure


 Q21. Which of the following data type you will prefer to store price - BigDecimal or Double ?
Ans. BigDecimal if memory and Performance is not critical concern, otherwise double.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types   double   bigdecimal


 Q22. Which takes more memory - float or Float ?Core Java
Ans. float is a native data type whereas Float is a class. A Float object will always take more memory than float variable as there are metadata overheads with the objects.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data type   float     Asked in 3 Companies      basic        frequent


 Q23. What is the size of long data type ?

a. 16 bit
b. 32 bit
c. 64 bit
d. 128 bit
Ans. 64 bit

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types


 Q24. What is the size of double type ?

a. 16 bit
b. 32 bit
c. 64 bit
d. 128 bit
Ans. 64 bit

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types


 Q25. What is the size of short type ?

a. 8 bit
b. 16 bit
c. 32 bit
d. 128 bit
Ans. 16 bit

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   data types


 Q26. What is ADT or Abtstract Data Type ?Core Java
Ans. ADT is a container which holds different types of objects with specifications.

For example - Stack, Array, Liked list, Tree

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     data types  abstract data types


 Q27. Why calculations in float or Double sometimes gives unpredictable results ?Core Java
Ans. Because the way float values are stored its not precise.

For example - 0.1 is actually stored as
0.1000000000000000055511151231257827021181583404541015625

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     double  float  data type      basic        frequent


 Q28. How does Java handle integer overflows and underflows?Core Java
Ans. It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     integer  data types     Asked in 1 Companies        rare


 Q29. What are the different primitive data types in Java ?Core Java
Ans. boolean
byte
char
double
float
int
long
short
void

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     data types  primitive data types     Asked in 1 Companies      Basic


 Q30. Difference between int and short data types ?Core Java
Ans. Both holds numeric values. short is a 16-bit signed two's complement integer whereas int is a 32-bit signed two's complement integer.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     data types  short vs int


next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: